<%--
  Created by IntelliJ IDEA.
  User: 113
  Date: 2020/12/2
  Time: 17:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% String path=request.getContextPath(); %>
<html>
<head>
    <meta http-equive="content-type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" src="<%=path %>/js/jquery-1.8.3.min.js"></script>

    <style type="text/css">
        body{
            background: #444;
            color:#CCC;
            margin-top:12px;
        }
        .big{
            height:45px;
            line-height:45px;
            padding-left:28px;
            font-size:14px;
            border:#999;
            color:#CCC;
        }
        .small{
            height:35px;
            line-height:35px;
            padding-left:48px;
            font-size:12px;
            background:#363636;
        }
        .box{
            /*开始时让二级菜单隐藏*/
            display:none;
        }
    </style>
</head>
<script>
    $(function(){
        //一级菜单点击后
        $(".big").click(function(){
            $(".box").hide(300);//二级标签全部隐藏
            $(this).next().show(300);//父标签下的子标签显示
        })
    })
</script>
<body>
<!-- 从session中获取当前用户的权限，并遍历 -->
<c:forEach items="${pris }" var="pri" varStatus="s">
    <!-- 没有父id的，作为一级菜单 -->
    <c:if test="${empty pri.pid }" var="r" scope="request">
        <div class="big">
                ${pri.priname }
        </div>

        <div class="box">
            <!-- 有父id的，作为二级菜单，并且跟在相应的一级菜单下 -->
            <c:forEach items="${pris }" var="pri2">
                <c:if test="${!empty pri2.pid && pri2.pid==pri.priid}">
                    <div class="small">
                        <a href="${ pri2.priurl}" target="main">${pri2.priname }</a>
                    </div>
                </c:if>
            </c:forEach>
        </div>
    </c:if>
</c:forEach>
</body>
</html>

